package m.store.model;

import m.base.model.StoreInfo;
import m.common.model.*;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name = "ts_guest_back_amount", description = "客户到款金额")
public class GuestBackAmount extends Model implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.eq("store.oid",storeOid))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }
    @LinkTableMeta(name="store_oid",table= StoreInfo.class,description="所属商户")
    private StoreInfo store;
    @LinkTableMeta(name="guest_oid",table= GuestInfo.class,description="所属客户")
    private GuestInfo guest;
    @FieldMeta(name = "type",type = FieldType.STRING,length = 10,description = "货款往来",dictOption = "P:付款,I:收款")
    private String type;
    public final static String Type_Pay="P";
    public final static String Type_Income="I";
    @FieldMeta(name = "business",type = FieldType.STRING,length = 10,description = "主营业务",dictOption = "Y:是,N:否")
    private String business;
    public final static String Business_Yes="Y";
    public final static String Business_No="N";
    @FieldMeta(name = "mode",type = FieldType.STRING,length = 10,description = "支付方式",dictOption = "A:银联支付,B:支付宝,C:微信,X:其他")
    private String mode;
    public final static String Mode_Bank="A";
    public final static String Mode_Alipay="B";
    public final static String Mode_Wechat="C";
    public final static String Mode_Other="X";
    @FieldMeta(name="back_date",type= FieldType.DATE,description="支付时间")
    private Date backDate;
    @FieldMeta(name="back_amount",type= FieldType.DOUBLE,defaultValue = "0",description="支付金额")
    private Double backAmount;
    @FieldMeta(name = "remark",type = FieldType.STRING,length = 1000,description = "备注")
    private String remark;

    @FieldMeta(name="link_amount",type= FieldType.DOUBLE,defaultValue = "0",description="关联金额")
    private Double linkAmount;
    @FieldMeta(name = "link_status",type = FieldType.STRING,length = 10,description = "关联状态",dictOption = "Y:全部关联,A:部分关联,N:未关联")
    private String linkStatus;
    public final static String LinkStatus_Done="Y";
    public final static String LinkStatus_linking="A";
    public final static String LinkStatus_No="N";

    public String getBusiness() {
        return business;
    }

    public void setBusiness(String business) {
        this.business = business;
    }

    public StoreInfo getStore() {
        return store;
    }

    public void setStore(StoreInfo store) {
        this.store = store;
    }

    public GuestInfo getGuest() {
        return guest;
    }

    public void setGuest(GuestInfo guest) {
        this.guest = guest;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public Date getBackDate() {
        return backDate;
    }

    public void setBackDate(Date backDate) {
        this.backDate = backDate;
    }

    public Double getBackAmount() {
        return backAmount;
    }

    public void setBackAmount(Double backAmount) {
        this.backAmount = backAmount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Double getLinkAmount() {
        return linkAmount;
    }

    public void setLinkAmount(Double linkAmount) {
        this.linkAmount = linkAmount;
    }

    public String getLinkStatus() {
        return linkStatus;
    }

    public void setLinkStatus(String linkStatus) {
        this.linkStatus = linkStatus;
    }
}
